package edu.yngsxy.communityservice.sys.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import edu.yngsxy.communityservice.core.model.entity.WkBaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
/**
 * <p>
 * 用户：存储系统用户信息
 * </p>
 *
 * @author lr
 * @since 2025-09-09
 */
@Getter
@Setter
@ToString
@TableName("sys_user")
@Accessors(chain = true)
@Schema(description = "用户：存储系统用户信息")
public class SysUser extends WkBaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 用户名
     */
    @TableField("username")
    @Schema(title = "用户名", description = "用户名", requiredMode =Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "用户名不能为空")
    @Size(max = 20, message = "用户名长度不能超过20个字符")
    private String username;

    /**
     * 真实姓名
     */
    @TableField("truename")
    @Schema(title = "真实姓名", description = "真实姓名", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 20, message = "真实姓名长度不能超过20个字符")
    private String truename;

    /**
     * 密码
     */
    @TableField("password")
    @Schema(title = "密码", description = "密码", requiredMode =Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "密码不能为空")
    @Size(max = 60, message = "密码长度不能超过60个字符")
    private String password;

    /**
     * 邮箱
     */
    @TableField("email")
    @Schema(title = "邮箱", description = "邮箱", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 50, message = "邮箱长度不能超过50个字符")
    private String email;

    /**
     * 简介
     */
    @TableField("intro")
    @Schema(title = "简介", description = "简介", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 500, message = "简介长度不能超过500个字符")
    private String intro;

    /**
     * 头像
     */
    @TableField("photo")
    @Schema(title = "头像", description = "头像", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 500, message = "头像长度不能超过500个字符")
    private String photo;

    /**
     * OpenID：微信为每个小程序用户分配的唯一标识
     */
    @TableField("wxmp_openid")
    @Schema(title = "OpenID", description = "微信为每个小程序用户分配的唯一标识", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 32, message = "OpenID长度不能超过32个字符")
    private String wxmpOpenid;

    /**
     * session_key：微信服务器在用户通过 wx.login 接口登录小程序时，与 openid 一起返回给开发者服务器的一个会话密钥。它是一个由微信生成的、对每个用户会话唯一的字符串，并且只有微信服务器和开发者服务器知道
     */
    @TableField("wxmp_session_key")
    @Schema(title = "session_key", description = "微信服务器在用户通过 wx.login 接口登录小程序时，与 openid 一起返回给开发者服务器的一个会话密钥。它是一个由微信生成的、对每个用户会话唯一的字符串，并且只有微信服务器和开发者服务器知道", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 32, message = "session_key长度不能超过32个字符")
    private String wxmpSessionKey;
}
